/* 组件样式 */

/* 加载更多历史记录的样式 */
.loading-more-history {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: var(--color-soft);
  border-radius: 8px;
  margin: 8px 16px;
  border: 1px solid var(--color-border);
}

.loading-spinner {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-spinner::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-a20);
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 没有更多历史记录的提示 */
.no-more-history {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  margin: 8px 16px;
}

.no-more-text {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 400;
}

/* 侧边栏样式 */
.sidebar {
  width: 280px;                    /* 宽度 */
  background: var(--color-bg);     /* 白色背景 */
  border-right: 1px solid var(--color-border); /* 右边框 */
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease, overflow 0.3s ease, border-right 0.3s ease;
  position: relative;
  height: 100vh;
}

.sidebar.hidden {
  transform: translateX(-100%);
  width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar.visible {
  transform: translateX(0);
  width: 280px;
  border-right: 1px solid var(--color-border);
}

.sidebar-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
}

.new-session-btn {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px var(--primary-a15);
}

.new-session-btn:hover:not(:disabled) {
  background: var(--color-primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-a25);
}

.new-session-btn:disabled {
  background: var(--color-soft);
  color: var(--color-subtext);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.sessions-list {
  flex: 1;                        /* 占满剩余高度 */
  overflow-y: auto;               /* 垂直滚动 */
  padding: 4px 1px 1px;           /* 内边距 */
  scrollbar-width: thin;          /* 细滚动条 */
  scrollbar-color: var(--primary-a30) transparent; /* 滚动条颜色 */
  position: relative;
  display: flex;
  flex-direction: column;
}

.sessions-list::-webkit-scrollbar {
  width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
  background: transparent;
}

.sessions-list::-webkit-scrollbar-thumb {
  background: var(--primary-a30);
  border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb:hover {
  background: var(--primary-a50);
}

.loading-sessions {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 500;
}

/* 会话项 (.session-item) */
.session-item {
  display: flex;                  /* Flex布局 */
  align-items: center;            /* 垂直居中 */
  padding: 0px 5px;               /* 内边距 */
  margin: 0 -1px 0px;             /* 外边距 */
  border-radius: 4px;             /* 圆角 */
  cursor: pointer;                /* 鼠标指针 */
  transition: all 0.2s ease;      /* 过渡动画 */
  border: none !important;        /* 无边框 */
  background: transparent !important; /* 透明背景 */
  position: relative;
}

.session-item:hover {
  background: transparent !important;
  border: none !important;
}

.session-item.active {
  background: transparent !important;
  border: none !important;
}

.session-content {
  flex: 1;
  min-width: 0;
  padding-left: 8px;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
}

/* 会话标题 (.session-title) */
.session-title {
  font-size: 13px;                /* 字体大小 */
  font-weight: 350;               /* 字体粗细 */
  color: var(--color-text);       /* 文字颜色 */
  white-space: nowrap;            /* 不换行 */
  overflow: hidden;               /* 溢出隐藏 */
  text-overflow: ellipsis;        /* 省略号 */
  line-height: 1.2;               /* 行高 */
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 激活状态 */
.session-item.active .session-title {
  color: var(--color-primary);     /* 主色调 */
  font-weight: 450;               /* 加粗 */
}


.session-title-input {
  width: 100%;
  border: 2px solid var(--color-primary);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-primary);
  transition: all 0.2s ease;
}

.session-title-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--primary-a10);
}

.session-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: all 0.2s ease;
  transform: translateX(2px);
}

.session-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--color-muted);
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-weight: bold;
}

.session-menu-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-muted);
}

.session-item:hover .session-actions,
.session-item.active .session-actions {
  opacity: 1;
}

/* 弹窗容器 */
.session-modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  min-width: 160px;
  max-width: 200px;
  overflow: hidden;
  animation: modalFadeIn 0.15s ease-out;
  z-index: 1000;
  word-wrap: break-word;
  word-break: break-word;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 弹窗内容 */
.session-modal-content {
  padding: 8px 0;
}

.session-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text);
  transition: all 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-weight: 500;
}

.session-modal-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.session-modal-item.danger {
  color: #ff3b30;
}

.session-modal-item.danger:hover {
  background: rgba(255, 59, 48, 0.08);
}

.modal-icon {
  width: 20px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-subtext);
}

.modal-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}


.edit-btn, .delete-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--primary-a20);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.edit-btn {
  color: var(--color-primary);
}

.edit-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--primary-a40);
  transform: scale(1.05);
}

.delete-btn {
  color: #f44336;
}

.delete-btn:hover {
  background: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.4);
  transform: scale(1.05);
}

.sidebar-toggle {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  color: var(--color-primary);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.sidebar-toggle:hover {
  background: var(--primary-a05);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-a15);
}

/* 输入区域样式 */
.input-area {
  padding: 16px 20px;
  background: linear-gradient(180deg, transparent 0%, var(--primary-a05) 100%);
  border-top: 1px solid var(--color-border);
  position: relative;
  backdrop-filter: blur(10px);
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--color-bg);
  border-radius: 28px;
  padding: 8px 12px;
  border: 2px solid var(--color-border);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
  max-width: 1080px;
  max-height: 50px;
  margin: 0 auto;
  cursor: text;
}

.input-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary-a20) 20%,
    var(--primary-a40) 50%,
    var(--primary-a20) 80%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.input-container:focus-within {
  border-color: var(--color-primary);
  box-shadow:
    0 0 0 3px var(--primary-a12),
    0 8px 32px rgba(31, 115, 183, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.input-container:focus-within::before {
  opacity: 1;
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 15px;
  line-height: 1.6;
  max-height: 140px;
  min-height: 20px;
  color: var(--color-text);
  font-weight: 400;
  padding: 2px 0;
  position: relative;
  z-index: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.message-input::placeholder {
  color: var(--color-subtext);
  font-weight: 400;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.7;
}

.message-input:focus::placeholder {
  color: var(--color-primary);
  opacity: 0.5;
  transform: translateY(-2px);
}

.input-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.voice-btn {
  background: var(--primary-a08);
  border: 1px solid var(--primary-a20);
  color: var(--color-primary);
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px var(--primary-a15);
}

.voice-btn:hover {
  background: var(--primary-a15);
  border-color: var(--primary-a40);
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--primary-a25);
}

.send-btn {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px var(--primary-a20),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.send-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-strong) 0%, var(--color-primary) 100%);
  transform: scale(1.08) translateY(-2px);
  box-shadow:
    0 8px 24px var(--primary-a30),
    0 4px 12px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.send-btn:hover:not(:disabled)::before {
  width: 120px;
  height: 120px;
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95) translateY(0px);
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:disabled {
  background: var(--color-soft);
  color: var(--color-subtext);
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.send-btn:disabled::before {
  display: none;
}

/* 停止生成按钮样式 */
.stop-btn {
  background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
  color: white;
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.stop-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stop-btn:hover {
  background: linear-gradient(135deg, #ff3742 0%, #ff2d3a 100%);
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 71, 87, 0.4);
}

.stop-btn:hover::before {
  width: 120px;
  height: 120px;
}

.stop-btn:active {
  transform: scale(0.95) translateY(0px);
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}


.input-footer {
  text-align: center;
  font-size: 12px;
  color: var(--color-subtext);
  margin-top: 12px;
  font-weight: 500;
  opacity: 0.8;
}

/* 侧边栏底部用户管理区域 */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
  margin-top: auto;
}

.user-management {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-subtext);
}

.user-management:hover {
  background: var(--primary-a05);
  color: var(--color-primary);
}

.user-management .user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.user-management .user-avatar .material-icons {
  font-size: 14px;
}

.user-management-text {
  font-size: 13px;
  font-weight: 500;
}

/* Logo占位符样式 */
.logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.logo-icon {
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  width: 100px;
  height: 40px;
  border-radius: 6px;
  object-fit: contain;
}